<?php
namespace backend\controllers;

use app\models\Investor;
use Yii;
use yii\web\Controller;



/**
 * Site controller
 */
class InvestorController extends Controller
{
    public $enableCsrfValidation = false;

    //账户列表
    public function actionAccount()
    {
        $model=new Investor();
        $res=$model->accountlist();
        if ($res['code'] == 200) {
            return json_encode($res);
        } else {
            return json_encode(['code' => 401, 'message' => '绑定失败！', 'data' => '']);
        }
    }

    public function actionAccountdetail()
    {
        $get = Yii::$app->request->get();
        $model=new Investor();
        $res=$model->detailaccount($get);
        if ($res['code'] == 200) {
            return json_encode($res);
        } else {
            return json_encode(['code' => 401, 'message' => '绑定失败！', 'data' => '']);
        }

    }

    //资方列表
    public function actionList()
    {
        $model=new Investor();
        $res=$model->userlist();
        if ($res['code'] == 200) {
            return json_encode($res);
        } else {
            return json_encode(['code' => 401, 'message' => '绑定失败！', 'data' => '']);
        }
    }
    //资方详情
    public function actionDetail()
    {
        $get = Yii::$app->request->get();
        $model=new Investor();
        $res=$model->userdetail($get);
        if ($res['code'] == 200) {
            return json_encode($res);
        } else {
            return json_encode(['code' => 401, 'message' => '绑定失败！', 'data' => '']);
        }
    }

    //资方用户冻结
    public function actionUserFrozen()
    {
        $post = Yii::$app->request->post();
        $model=new Investor();
        $res=$model->frozen($post);
        if ($res['code'] == 200) {
            return json_encode($res);
        } else {
            return json_encode(['code' => 401, 'message' => '冻结用户失败！', 'data' => '']);
        }
    }

    //资方银行卡冻结
    public function actionCardfrozen()
    {
        $post = Yii::$app->request->post();
        $model=new Investor();
        $res=$model->frozencard($post);
        if ($res['code'] == 200) {
            return json_encode($res);
        } else {
            return json_encode(['code' => 401, 'message' => '冻结银行卡失败！', 'data' => '']);
        }
    }
}
